package com.studerb.tasks.interfaces;

import java.beans.PropertyChangeSupport;
import java.util.concurrent.RunnableFuture;
import java.util.concurrent.TimeUnit;

import com.studerb.nntp.NntpConnection;
import com.studerb.tasks.TaskPriority;

public interface ITask<T> extends RunnableFuture<T>{
    public void addTaskListener(ITaskListener listener);

    public boolean cancel(boolean arg0);
    
    public boolean pause();

    public boolean unpause();
    
    public NntpConnection getConnectionion();

    public String getDescription();

    public long getExecutionDuration(TimeUnit unit);

    public boolean getFailed();

    public String getMessage();

    public TaskPriority getPriority();

    public int getProgress();

    public PropertyChangeSupport getPropertyChangeSupport();

    String getTitle();

    void init();

    boolean isCancelled();
    
    boolean isPaused();

    boolean isConnectionNeeded();

    boolean isDeterminable();

    boolean isDone();

    void removeTaskListener(ITaskListener listener);

    void setConnection(NntpConnection conn);

    void setFailed(boolean failed);

    void setPriority(TaskPriority priority);
    
    String getCurrentState();
}
